function getVauleToIndex(arr: number[], value: number): number {
  let start = 0;
  let end = arr.length - 1;

  while (start <= end) {
    let index = Math.floor((start + end) / 2);
    const mid = arr[index];
    if (mid == value) {
      return index;
    }

    if (mid > value) {
      end = index - 1;
    } else {
      start = index + 1;
    }
  }

  return -1;
}

console.log(getVauleToIndex([1, 3, 5, 7, 7, 7, 7, 9, 11, 12, 13, 14], 7));

export {};
